//
//  Person.m
//  KVO
//
//  Created by Hello Cai on 2019/3/31.
//  Copyright © 2019 Hello Cai. All rights reserved.
//

#import "Person.h"

@implementation Person

//是否自动触发KVO，默认返回YES。返回NO表示禁止KVO自动触发，即添加完观察者后，不会动态创建子类
//+(BOOL)automaticallyNotifiesObserversForKey:(NSString *)key{
//    if ([key isEqualToString:NSStringFromSelector(@selector(age))]) {
//        return NO;
//    }else{
//        return [super automaticallyNotifiesObserversForKey:key];
//    }
//}



//- (void)setAge:(int)age
//{
//    _age = age;
//
//    NSLog(@"setAge:");
//}
//
//- (void)willChangeValueForKey:(NSString *)key
//{
//    [super willChangeValueForKey:key];
//
//    NSLog(@"willChangeValueForKey");
//}
//
//- (void)didChangeValueForKey:(NSString *)key
//{
//    NSLog(@"didChangeValueForKey - begin");
//
//    [super didChangeValueForKey:key];
//
//    NSLog(@"didChangeValueForKey - end");
//}
@end
